home *** CD-ROM | disk | FTP | other *** search
- Path: news1.h1.usa.pipeline.com!usenet
- From: grantp@usa.pipeline.com(Pete)
- Newsgroups: comp.lang.c++
- Subject: Re: LPCREATESTRUCT
- Date: 7 Feb 1996 23:34:09 GMT
- Organization: Kalevi, Inc.
- Message-ID: <4fbcth$6et@news1.usa.pipeline.com>
- NNTP-Posting-Host: pipe2.h1.usa.pipeline.com
- X-PipeUser: grantp
- X-PipeHub: usa.pipeline.com
- X-PipeGCOS: (Pete)
- X-Newsreader: Pipeline USA v3.3.0
-
- On Feb 07, 1996 14:13:43 in article <LPCREATESTRUCT>, 'chris@sound.net
- (chris)' wrote:
-
-
- >I am unable to determine what lpcreatestruct in doing in the following
- >line of code. It is in a windows procedure, within the code that is
- >executed during the processing of the wm_create message.
- >
- >hInstance = ((LPCRETESTRUCT) lParam) -> hInstance;
- >
- >If you can point me in the right direction, I would appreciate it.
- >Also, do you know where I might find this in the online documentation
- >for the Borland Compiler (version 4.2).
- >
- Chances are that you ran into this on a function that responds
- to a Windows message. The standard Windows response -- or
- callback -- function has the prototype:
-
- int CALLBACK foo(HWND hWnd, WPARAM wp, LPARAM lParam);
-
- Certain Windows messages; e.g., WM_NCCREATE, receive a pointer
- to a structure that provides extra parameters to the response functions.
- In such cases, the message response function must cast the lParam
- variable (defined as long) into a pointer to a pointer to the structure.
- Windows.h defines (in its typical fashion):
-
- typedef CREATESTRUCT FAR * LPCREATESTRUCT;
-
- One of the slots in CREATESTRUCT is the handle to the parent
- process instance; hInstance. So, the gist of the line you
- asked about is that the callee is extracting the instance handle
- from the structure passed as the third parameter of the Windows
- callback function.
-
- If you've never done any raw Windows API programming, this
- "explanation" probably served only to confuse rather than
- clarify. Oh well, such is life.
-
- --
- Pete Grant
- Kalevi, Inc.
- Object Oriented Software Development
- ... and raw Windows API too! But 32-bit only:-)
-